/**
 * Framework for batch testing user profile models
 * Final project by Sergey Nepomnyachiy and Julia Polchin
 * Supervisor: Tsvi Kuflik
 *
 */
package backend;

import interfaces.ProgressKeeperInterface;
import javax.swing.JProgressBar;

/**
 * Implementing ProgressKeeperInterface with a swing component JProgressBar
 * @author Sergey and Julia
 *
 */public class JProgKeeper implements ProgressKeeperInterface {

	/**
	 *  JProgKeeper in this case is a this wrapper around  JProgressBar
	 */
	public  JProgressBar jpb = new JProgressBar() ;
	private int size = -1;
	private int value = 0;
	@Override
	public void add(int Length) {
		this.size += Length;
		this.jpb.setMaximum(this.size);
		this.jpb.setIndeterminate(false);
	}

	@Override
	public int getMax() {
		return this.size;
	}

	@Override
	public void setIndeterminate(boolean state) {
		this.jpb.setIndeterminate(state);
		
	}

	@Override
	public void setMaximum(int newLength) {
		this.size = newLength;
		this.jpb.setMaximum(this.size);
	}

	@Override
	public void increment() {
		this.jpb.setValue(this.value++);
	}

}
